﻿@model DoAnWebsite.Models.Answer
@using Ext.Net
@using Ext.Net.MVC
@{
    ViewBag.Title = "Edit Answer";
    Layout = "~/Views/Shared/_Layout_Admin.cshtml";
}

@section Header
{
}
@section ToolbarSection{
    @Html.X().Button().Text("Save").ID("btnSave").Disabled(true).Icon(Icon.Disk).DirectEvents(de =>
            {
                de.Click.Url = Url.Action("EditAnswer");
                de.Click.EventMask.ShowMask = true;
                de.Click.FormID = "FormPanelEditAnswer";
            })
    
    @Html.X().Button().Text("Back").Icon(Icon.ArrowLeft).Margins("0 0 0 10").Listeners(ls => ls.Click.Handler = "window.parent.location.reload();parentAutoLoadControl.close();")
}

@Html.X().FormPanel().ID("FormPanelEditAnswer").Title("Edit Answer").StyleSpec("position: static; z-index: 10;width: 100%;").AutoScroll(true).Listeners(
ls => ls.ValidityChange.Handler = "App.btnSave.setDisabled(!valid)").Items(
        Html.X().HiddenFor(m=>m.AnswerId),
        Html.X().HiddenFor(m=>m.AskId),
        Html.X().HtmlEditorFor(m => m.Content).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px").Flex(1),
        Html.X().DateFieldFor(m=>m.CreateDate).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px").Flex(1),
        Html.X().TextFieldFor(m => m.AuthorName).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px").Flex(1),
        Html.X().TextFieldFor(m => m.Email).Width(800).LabelWidth(130).StyleSpec("Margin: 15px 0px 0px 100px").Flex(1),
        Html.X().CheckboxFor(m=>m.Active).LabelWidth(130).StyleSpec("Margin: 15px 0px 30px 100px").Flex(1)
)